package com.ruoyi.cngj.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cngj.mapper.CngjHonorMapper;
import com.ruoyi.cngj.domain.CngjHonor;
import com.ruoyi.cngj.service.ICngjHonorService;
import com.ruoyi.common.core.text.Convert;

/**
 * 荣誉专利Service业务层处理
 * 
 * @author yuexl
 * @date 2024-06-27
 */
@Service
public class CngjHonorServiceImpl implements ICngjHonorService 
{
    @Autowired
    private CngjHonorMapper cngjHonorMapper;

    /**
     * 查询荣誉专利
     * 
     * @param id 荣誉专利ID
     * @return 荣誉专利
     */
    @Override
    public CngjHonor selectCngjHonorById(String id)
    {
        return cngjHonorMapper.selectCngjHonorById(id);
    }

    /**
     * 查询荣誉专利列表
     * 
     * @param cngjHonor 荣誉专利
     * @return 荣誉专利
     */
    @Override
    public List<CngjHonor> selectCngjHonorList(CngjHonor cngjHonor)
    {
        return cngjHonorMapper.selectCngjHonorList(cngjHonor);
    }

    /**
     * 新增荣誉专利
     * 
     * @param cngjHonor 荣誉专利
     * @return 结果
     */
    @Override
    public int insertCngjHonor(CngjHonor cngjHonor)
    {
        cngjHonor.setId(IdWorker.getId());
        cngjHonor.setCreateTime(DateUtils.getNowDate());
        return cngjHonorMapper.insertCngjHonor(cngjHonor);
    }

    /**
     * 修改荣誉专利
     * 
     * @param cngjHonor 荣誉专利
     * @return 结果
     */
    @Override
    public int updateCngjHonor(CngjHonor cngjHonor)
    {
        cngjHonor.setUpdateTime(DateUtils.getNowDate());
        return cngjHonorMapper.updateCngjHonor(cngjHonor);
    }

    /**
     * 删除荣誉专利对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCngjHonorByIds(String ids)
    {
        return cngjHonorMapper.deleteCngjHonorByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除荣誉专利信息
     * 
     * @param id 荣誉专利ID
     * @return 结果
     */
    @Override
    public int deleteCngjHonorById(String id)
    {
        return cngjHonorMapper.deleteCngjHonorById(id);
    }
}
